﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WordWonderGame.Business;

namespace WordWonderGame.UI.Man4
{
    public partial class FormMan4 : UserControl
    {
        FormTraLoi frmTraLoi;
        TimerMan4 frmTimer;
        public event EventHandler QuaMan4Roi;
        public FormMan4()
        {
            InitializeComponent();
            //frmTraLoi
            frmTraLoi = new FormTraLoi();
            frmTraLoi.Dock = DockStyle.Fill;
            frmTraLoi.Parent = pnTraLoi;
            frmTraLoi.Visible = false;
            frmTraLoi.TraLoiDung += new EventHandler(frmTraLoi_TraLoiDung);
            frmTraLoi.DungHetRoi += new EventHandler(frmTraLoi_DungHetRoi);
            //frmTimer
            frmTimer = new TimerMan4();
            frmTimer.Dock = DockStyle.Fill;
            frmTimer.Parent = pnTimer;
            frmTimer.Visible = false;
            frmTimer.XongMan4 += new EventHandler(frmTimer_XongMan4);
        }

        void frmTimer_XongMan4(object sender, EventArgs e)
        {
            if (QuaMan4Roi != null)
            {
                QuaMan4Roi(sender, null);
            }
        }

        void frmTraLoi_DungHetRoi(object sender, EventArgs e)
        {
            frmTimer.CongDiemQuaMan();
        }

        void frmTraLoi_TraLoiDung(object sender, EventArgs e)
        {
            frmTimer.TraLoiDung();
        }

        private void FormMan4_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Visible = false;
            frmTimer.Visible = true;
            frmTimer.StartTimer();
            frmTraLoi.Visible = true;
            DataClassDAL dataClass = new DataClassDAL();
            CauHoiMan4 cauhoi = dataClass.LayCauHoiMan4();
            frmTraLoi.LoadCauHoi(cauhoi.ListCauHoi);
        
        }

    }
}
